﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
		xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:Ribbon="clr-namespace:Microsoft.Windows.Controls.Ribbon;assembly=RibbonControlsLibrary">
	<Style TargetType="Ribbon:RibbonButton">
		<Setter Property="Template">
			<Setter.Value>
				<ControlTemplate TargetType="Ribbon:RibbonButton">
					<Border x:Name="OuterBorder" BorderBrush="{TemplateBinding BorderBrush}"
							BorderThickness="{TemplateBinding BorderThickness}"
							Background="{TemplateBinding Background}" SnapsToDevicePixels="True"
							Padding="{TemplateBinding Padding}">
						<StackPanel x:Name="StackPanel" IsHitTestVisible="False">
							<Image x:Name="PART_Image" RenderOptions.BitmapScalingMode="NearestNeighbor"
									HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Height="32"
									Margin="0,2" Source="{TemplateBinding LargeImageSource}" VerticalAlignment="Center"
									Width="32" />
							<Ribbon:RibbonTwoLineText x:Name="TwoLineText" HorizontalAlignment="Center"
									LineStackingStrategy="BlockLineHeight" LineHeight="13" Margin="1,3,1,0"
									TextAlignment="Center" Text="{TemplateBinding Label}" VerticalAlignment="Top" />
						</StackPanel>
					</Border>
					<ControlTemplate.Triggers>
						<DataTrigger
								Binding="{Binding ControlSizeDefinition.ImageSize, RelativeSource={RelativeSource Self}}"
								Value="Large">
							<Setter Property="MinWidth" Value="42" />
							<Setter Property="Height" Value="69" />
							<Setter Property="MinHeight" TargetName="TwoLineText" Value="26" />
							<Setter Property="Ribbon:RibbonTwoLineText.HasTwoLines" TargetName="TwoLineText"
									Value="True" />
						</DataTrigger>
						<DataTrigger
								Binding="{Binding ControlSizeDefinition.ImageSize, RelativeSource={RelativeSource Self}}"
								Value="Small">
							<Setter Property="Height" Value="22" />
							<Setter Property="Margin" TargetName="PART_Image" Value="1,0" />
							<Setter Property="Source" TargetName="PART_Image"
									Value="{Binding SmallImageSource, RelativeSource={RelativeSource TemplatedParent}}" />
							<Setter Property="Width" TargetName="PART_Image" Value="16" />
							<Setter Property="Height" TargetName="PART_Image" Value="16" />
							<Setter Property="HorizontalAlignment" TargetName="TwoLineText" Value="Left" />
							<Setter Property="VerticalAlignment" TargetName="TwoLineText" Value="Center" />
							<Setter Property="Margin" TargetName="TwoLineText" Value="1" />
							<Setter Property="Orientation" TargetName="StackPanel" Value="Horizontal" />
						</DataTrigger>
						<Trigger Property="IsInQuickAccessToolBar" Value="True">
							<Setter Property="Margin" TargetName="PART_Image" Value="2,0,1,0" />
							<Setter Property="Width" TargetName="PART_Image" Value="16" />
							<Setter Property="Height" TargetName="PART_Image" Value="16" />
							<Setter Property="Visibility" TargetName="TwoLineText" Value="Collapsed" />
						</Trigger>
						<DataTrigger
								Binding="{Binding ControlSizeDefinition.IsLabelVisible, RelativeSource={RelativeSource Self}}"
								Value="False">
							<Setter Property="Visibility" TargetName="TwoLineText" Value="Collapsed" />
						</DataTrigger>
						<DataTrigger
								Binding="{Binding ControlSizeDefinition.ImageSize, RelativeSource={RelativeSource Self}}"
								Value="Collapsed">
							<Setter Property="Visibility" TargetName="PART_Image" Value="Collapsed" />
						</DataTrigger>
						<Trigger Property="IsMouseOver" Value="True">
							<Setter Property="Background" TargetName="OuterBorder"
									Value="{Binding MouseOverBackground, RelativeSource={RelativeSource TemplatedParent}}" />
							<Setter Property="BorderBrush" TargetName="OuterBorder"
									Value="{Binding MouseOverBorderBrush, RelativeSource={RelativeSource TemplatedParent}}" />
						</Trigger>
						<Trigger Property="IsKeyboardFocused" Value="True">
							<Setter Property="Background" TargetName="OuterBorder"
									Value="{Binding FocusedBackground, RelativeSource={RelativeSource TemplatedParent}}" />
							<Setter Property="BorderBrush" TargetName="OuterBorder"
									Value="{Binding FocusedBorderBrush, RelativeSource={RelativeSource TemplatedParent}}" />
						</Trigger>
						<Trigger Property="IsPressed" Value="True">
							<Setter Property="Background" TargetName="OuterBorder"
									Value="{Binding PressedBackground, RelativeSource={RelativeSource TemplatedParent}}" />
							<Setter Property="BorderBrush" TargetName="OuterBorder"
									Value="{Binding PressedBorderBrush, RelativeSource={RelativeSource TemplatedParent}}" />
						</Trigger>
						<Trigger Property="IsInControlGroup" Value="True">
							<Setter Property="BorderBrush" TargetName="OuterBorder"
									Value="{Binding Ribbon.BorderBrush, RelativeSource={RelativeSource TemplatedParent}}" />
							<Setter Property="BorderThickness" TargetName="OuterBorder" Value="0,0,1,0" />
						</Trigger>
						<Trigger Property="IsEnabled" Value="False">
							<Setter Property="Opacity" TargetName="PART_Image" Value="0.5" />
							<Setter Property="TextElement.Foreground" TargetName="OuterBorder" Value="#FF9E9E9E" />
						</Trigger>
					</ControlTemplate.Triggers>
				</ControlTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</ResourceDictionary>